Repository navigation
transformation(): fix the sign of the FFT fallback translation (split from #1426) - #1436
Merged
mfitzasp merged 1 commit intoDec 2, 2026
Conversation
phase_cross_correlation(roi_current, roi_reference) returns the shift that moves the reference onto the current frame; the transform must map reference pixels onto the current frame (as the astroalign and imreg_dft branches do), so the shift is used with a positive sign. The negated sign sent a star at (100, 80) in a field moved by (+10, +5) to (90, 75) instead of (110, 85). Fix originally in rzellem#1426 (commit 8f30f97), split out so it can land on its own; regression test exercises transformation() with the other branches forced to fail.
mfitzasp
merged commit Dec 2, 2026
7824fa8
into
rzellem:michael_fitzgeralds_wonderful_branch_of_magic
12 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #1426 (commit 8f30f97) so it can land on its own, as discussed with Michael.
The bug. In
transformation(), the FFT fallback callsphase_cross_correlation(roi_current, roi_reference), whose shift moves the reference onto the current frame. Every caller applies the returned transform to reference-frame pixels to get current-frame pixels, and the astroalign and imreg_dft branches already return transforms in that direction. The FFT branch negated the shift, so it pointed the wrong way: for a field moved by (+10, +5) px, a star at (100, 80) was sent to (90, 75) instead of (110, 85).When it matters. Only when the FFT translation is the transform that gets used: in practice the last-resort fallback on the hardest frames, after the feature-matching stages fail (it fired on 1-8 frames in 5 of my 434 MicroObservatory run logs). The "high-confidence FFT" shortcut almost never triggers, because the default normalisation reports error 1.0 even for an exact synthetic shift (skimage 0.26).
Change. One line (
translation=[shift[1], shift[0]]) plus a comment, andtests/test_fft_alignment_sign.py, which callstransformation()on a synthetic (+10, +5) field with astroalign and imreg_dft forced to fail. It passes with the fix and fails on the current tip.